package com.sikao.app.ui;

import android.os.Bundle;
import android.view.View;
import android.widget.ImageView;
import android.widget.TextView;

import com.nostra13.universalimageloader.core.ImageLoader;
import com.sikao.app.R;
import com.sikao.app.bean.NoticeBean;
import com.sikao.app.net.HttpApi;
import com.sikao.app.ui.base.BaseActivity;
import com.sikao.app.utils.TimeUtil;

public class NewsDetailActivity extends BaseActivity implements View.OnClickListener {

	private TextView titleTv;
	private ImageView backIv;
	private TextView themeTv;
	private TextView tvBrowseVolume;
	private TextView tvName;
	private TextView tvTime;
	private ImageView iv;
	private TextView contentTv;
	private NoticeBean.ResBean.ListBean bean;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		setContentView(R.layout.activity_news_detail);
		super.onCreate(savedInstanceState);
	}

	@Override
	protected void initData() {
		bean = getIntent().getParcelableExtra("bean");
	}

	@Override
	protected void initView() {
		titleTv = (TextView) findViewById(R.id.title_middle_tv);
		backIv = (ImageView) findViewById(R.id.title_left_img);
		themeTv = (TextView) findViewById(R.id.theme_tv);
		tvBrowseVolume = (TextView) findViewById(R.id.tv_browse_volume);
		tvName = (TextView) findViewById(R.id.tv_name);
		tvTime = (TextView) findViewById(R.id.tv_time);
		iv = (ImageView) findViewById(R.id.iv);
		contentTv = (TextView) findViewById(R.id.content_tv);
	}

	@Override
	protected void initListener() {
		backIv.setOnClickListener(this);
	}

	@Override
	protected void init() {
		titleTv.setText("详情");
		backIv.setVisibility(View.VISIBLE);
		themeTv.setText(bean.getTitle());
		contentTv.setText(bean.getDescription());
		tvBrowseVolume.setText(bean.getView());
		/*tvName.setText(bean.getAuther());
		tvTime.setText(TimeUtil.timeStampToTime(bean.getAdd_time(),TimeUtil.fotmatString2));
		if (bean.getImgsrc() != null && bean.getImgsrc().length() != 0) {
			ImageLoader.getInstance().displayImage("http://www.929898.org.cn/imgall/nfwwomjvfyzwy2lbnyxgg33n/2015/f2/116/d/3.jpg", iv);
			//HttpApi.BANNERUTL + bean.getImgsrc();
		} else {
			iv.setVisibility(View.GONE);
		}*/
		ImageLoader.getInstance().displayImage("http://www.929898.org.cn/imgall/nfwwomjvfyzwy2lbnyxgg33n/2015/f2/116/d/3.jpg", iv);/*HttpApi.BANNERUTL + bean.getProfile_pic()*/
	}

	@Override
	public void onClick(View v) {
		switch (v.getId()) {
			case R.id.title_left_img:
				finish();
				break;
			default:
				break;
		}
	}
}
